package com.example.taketaxi;

import pessoa.Pessoa;
import taxista.activities.FragmentListaClientesAdm;
import taxista.activities.FragmentListaTaxistasAdm;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.Menu;
import android.view.MenuItem;

public class PrincipalAdm extends FragmentActivity {
	private int CONTEINER_FRAGMENT = R.id.conteiner_fragment_principal_adm_taxistas;
	public Pessoa pessoa;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_principal_adm);
		
		Intent intent = getIntent();
		pessoa = (Pessoa)intent.getSerializableExtra("pessoa");
		
		//adicionando o fragment do mes e ano referencia
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
		FragmentListaTaxistasAdm fragmentTaxistas = new FragmentListaTaxistasAdm();
		ft.replace(CONTEINER_FRAGMENT, fragmentTaxistas);
		ft.commit();
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.principal_adm, menu);
		return true;
	}

	
	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
	    switch (item.getItemId()) {
	        case R.id.item_gerenciar_clientes:
	    		FragmentListaClientesAdm fragmentClientes = new FragmentListaClientesAdm();
	    		ft.replace(CONTEINER_FRAGMENT, fragmentClientes);
	    		ft.commit();
	        	return true;
	        case R.id.item_gerenciar_taxistas://adicionando o fragment do mes e ano referencia
	    		FragmentListaTaxistasAdm fragmentTaxistas = new FragmentListaTaxistasAdm();
	    		ft.replace(CONTEINER_FRAGMENT, fragmentTaxistas);
	    		ft.commit();
	    		return true;
	        default:
	            return super.onContextItemSelected(item);
	    }
	}
	
}
